<template>
	<div>
		<div ref="refDom">{{ value }}</div>

		<div>
			<div v-for="item of values">
				{{ item }}
			</div>
		</div>
	</div>
</template>
<script lang="ts" setup>
	import { ref } from 'vue';
	const value = ref('cs');
	const values = ref<Array<string>>([]);
	const refDom = ref();

	function setValue(val: string) {
		value.value = val;
	}
	// fdsafsdaf
	function getValue() {
		return value.value;
	}
	/**
	 * @return { string } 当前的值
	 * @expose  getValueList (i:[number]第几个)
	 * 获取数组中的值
	 */
	function getValueList(i: number) {
		return values.value[i];
	}

	/**
	 * @return { string } 当前的值
	 * @expose { } setValueList (arr:[Array<string>]数组值, val?:[string]当前数组)
	 * 设置数组值
	 */
	function setValueList(arr: Array<string>, val?: string) {
		values.value = arr;
		if (val) {
			setValue(val);
			return value.value;
		}
	}

	/**
	 * @expose { Element } dom 元素
	 * @expose setValue (val:[string]设置的数据 ) 设置值
	 * @expose {} getValue=([string]当前的值) () 获取当前值
	 */
	defineExpose({
		dom: refDom,
		setValue,
		getValue,
		setValueList,
		getValueList,
	});
</script>
<style lang="scss"></style>
